﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BMManage
{
    public partial class FormUser : Form
    {
        public FormUser()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            var loginname = dataGridView1.CurrentRow.Cells[lOGINNAMEDataGridViewTextBoxColumn.Name].Value.ToString();
            if (loginname.ToLower() == "admin")
            {
                MessageBox.Show("管理员用户不能删除");
            }
            else
            {
                BMWebService.BMWebService service = new BMWebService.BMWebService();
                dataGridView1.DataSource = service.deleteUser(loginname);
            }
        }

        private void FormUser_Load(object sender, EventArgs e)
        {
            BMWebService.BMWebService service = new BMWebService.BMWebService();
            dataGridView1.DataSource = service.deleteUser("");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FormUserAdd add = new FormUserAdd();
            add.ShowDialog();
            BMWebService.BMWebService service = new BMWebService.BMWebService();
            dataGridView1.DataSource = service.deleteUser("");
        }
    }
}
